﻿#ifndef GLOBALVARS_H
#define GLOBALVARS_H

#include <QQueue>
#include <QImage>
#include "userinfo.h"
#include "saveinfo.h"
#include "hotelinfo.h"
#include "houseinfo.h"
#include "reserveinfo.h"
#include "commentinfo.h"
#include "configoperate.h"

/// A B C D E F G   H I J K L M N O P Q R S T U V W X Y Z
/// A B C D E H I L M N P R S T U X
/// a b c d e h i l m n o p s t v
enum COMMAND{
    ///通用请求命令
    CMD_UserRegister_R = 'R',          //用户注册
    CMD_UserLogin_L = 'L',          //用户登录
    CMD_UserInfo_I = 'I',           //获取个人信息
    CMD_UpdateUserInfo_U = 'U',  //更新个人信息
    CMD_BusinessCertificate_C = 'C',  //实名认证
    CMD_HeadPic_i = 'i',           //获取头像
    CMD_UploadHeadPic_j = 'j',           //上传头像
    CMD_ModifyPswd_P = 'P',         //修改密码

    CMD_HotelSearch_S = 'S',   //酒店搜索
    CMD_HotelSearchNext_N = 'N',   //酒店搜索下一条数据
    CMD_HotelImageSearch_M = 'M',   //酒店搜索图片
    CMD_HotelImageOrder_o = 'o',   //酒店订单图片
    CMD_HotelImageSave_v = 'v',   //酒店收藏图片
    CMD_HotelImageDetail_t = 't',   //酒店详情图片
    CMD_HotelImageNext_n = 'n',   //酒店详情图片
    CMD_HotelCredImage_e = 'e',   //酒店证件图片

    CMD_HouseList_H = 'H',   //酒店房间列表
    CMD_HouseListNext_h = 'h',   //酒店房间下一个记录列表
    CMD_HouseImage_T = 'T',   //酒店房间图片

    CMD_SubmitReserve_D = 'D',   //提交订单
    CMD_ReserveList_d = 'd',   //获取订单
    CMD_ReserveDelete_l = 'l',   //删除订单
    CMD_ReserveDetails_a = 'a',   //获取订单详情

    CMD_SubmitComment_p = 'p',   //提交评论
    CMD_CommentList_A = 'A',   //获取评论
    CMD_CommentImage_E = 'E',   //获取评论图片
    CMD_SubmitCommentImage_m = 'm',   //提交评论图片

    CMD_SaveList_s = 's',   //获取收藏
    CMD_DeleteSave_B = 'B',   //删除收藏
    CMD_SubmitSave_c = 'c',   //提交收藏
    CMD_HotelDetailsByID_B = 'b',   //获取酒店详情

    ////////////////////////////////business////////////////////////////////
    CMD_HotelManageList_Z = 'Z',   //获取酒店管理列表
    CMD_HotelManageImage_z = 'z',   //获取酒店管理的图片
    CMD_DeleteHotel_Y = 'Y',   //删除酒店信息 -- 下架酒店
    CMD_DeleteHouse_y = 'y',   //删除酒店房间信息
    CMD_SubmitHotel_W = 'W',   //提交新的酒店信息
    CMD_SubmitHouse_w = 'w',   //提交新的房间信息
    CMD_SubmitHotelImage_Q = 'Q',   //提交新的酒店图片信息
    CMD_SubmitHouseImage_q = 'q',   //提交新的房间图片信息

    CMD_HotelManageIdAndName_V = 'V',   //获取酒店管理的id和名称
    CMD_OrderManageList_x = 'x',   //获取订单管理列表
    CMD_ModifyOrderState_u = 'u',   //修改订单状态

    CMD_SubmitBusComment_r = 'r',   //修改酒店的商家评论

    ////////////////////////////////worker////////////////////////////////
    CMD_UserCert_O = 'O',   //获取实名认证列表
    CMD_UserCertImage_K = 'K',   //获取实名认证图片
    CMD_UserCertResult_J = 'J',   //获取实名认证结果
    CMD_HotelCertResult_K = 'k',   //获取酒店认证结果
    CMD_UserExit_X = 'X',                ///用户退出
};

enum EditState{
    E_None = 0,
    E_WatchDetails,
    E_EditInfo,
    E_NewCreate,
};

enum RESPONSE{
    RES_Down = '!',
    RES_Fail = '?'
};

enum USER_ROLE{
    USER_User = 0,
    USER_Business,
    USER_Worker,
};

enum Msg_Type{
    Msg_Image = 'I',
    Msg_Word = 'W',
};

enum Image_Type{
    Image_HeadPic = 'H',
    Image_ID = 'I',
};

enum LogOut_State{
    LogOut_Exit = 0,
    LogOut_Offline,
};

enum Hotel_Condition{
    H_Select = 0,
    H_Type,
    H_Star,
    H_Mark,
    H_City,
    H_NameOrLocation,
    H_Price,
//    H_Location,
//    H_InTime,
//    H_OutTime,
};

enum Hotel_Mark_Condition{
    HMG_5_0 = 1,
    HMG_4_8,
    HMG_4_5,
    HMG_4_2,
    HMG_4_0,
    HML_4_0,
};


enum DaySelect{
    D_None = 0,
    D_TodayAll,
    D_YesterdayAll,
    D_WeekAll,
    D_MonthAll,
    D_CustomizeAll,
    D_TodayNo,
    D_YesterdayNo,
    D_WeekNo,
    D_MonthNo,
    D_CustomizeNo,
};

enum StarSelect{
    S_All= 0,
    S_One2Three,
    S_Four2Five,
};

typedef QList<QImage> ImageList;
typedef QMap<QString,ImageList::iterator> ImageMap;
typedef QMap<QString,ImageList*>  ImageListMap;
typedef QMap<QString,QImage> ImageMsgMap;//id + 项目 + 图片
class GlobalVars
{
public:
    GlobalVars();

    static ConfigOperate g_localConfig;

    static int count;
    static QVector<QString> week;
    static SaveInfo g_localSave;
    static UserInfo g_localUser;
    static HotelInfo g_localHotel;
    static HouseInfo g_localHouse;
    static ReserveInfo g_localReserve;
    static CommentInfo g_localComment;
    static ImageList g_hotelImageList;
    static ImageList g_houseImageList;

    static UserInfoList *g_userInfoList;
    static ReserveInfoList *g_reserveInfoList;
    static CommentInfoList *g_commentInfoList;

    /// 商家端 --- 用来存储已通过审核的酒店(服务器端没有进行筛选，发送来该用户的所有门店)
    /// 工作人员端 --- 用来存储提交审核的酒店(服务器端已经进行筛选，发送的即为未审核的酒店)
    static HotelInfoList *g_hotelManageList;
    static HotelInfoMap g_hotelManageMap;   /// 商家端在选择评论的酒店时，显示酒店的相关信息的存储容器
    static QMap<QString,QString> g_serverStyleSheet;
    static ImageListMap g_commentImageListMap;
    static QQueue<QString> g_msgQueue; //消息队列
    static QQueue<ImageMsgMap> g_ImageMsgQueue; //消息图像队列

    static void setWeek(QVector<QString> weekVec);
    static void setWeek(QStringList weekList);
    static void setHotelServerStyleSheetMap();
    static QPixmap PixmapToRound(const QPixmap &src, int radius);
};

#endif // GLOBALVARS_H
